1
|
|
|
import Vue from 'vue/dist/vue.js'; |
2
|
|
|
import axios from 'axios' |
3
|
|
|
import App from './components/App.vue'; |
4
|
|
|
import ElementUI from 'element-ui' |
5
|
|
|
import lang from 'element-ui/lib/locale/lang/en' |
6
|
|
|
import locale from 'element-ui/lib/locale' |
7
|
|
|
import VueHtml5Editor from 'vue-html5-editor' |
8
|
|
|
|
9
|
|
|
Vue.use(VueHtml5Editor, { |
10
|
|
|
name: "vue-html5-editor", |
11
|
|
|
// if set true,will append module name to toolbar after icon |
12
|
|
|
showModuleName: true, |
13
|
|
|
// config image module |
14
|
|
|
image: { |
15
|
|
|
// max file size |
16
|
|
|
sizeLimit: 512 * 1024, |
17
|
|
|
// upload config,default null and convert image to base64 |
18
|
|
|
upload: { |
19
|
|
|
url: null, |
20
|
|
|
headers: {}, |
21
|
|
|
params: {}, |
22
|
|
|
fieldName: {} |
23
|
|
|
}, |
24
|
|
|
// compression config,default resize image by localResizeIMG (https://github.com/think2011/localResizeIMG) |
25
|
|
|
// set null to disable compression |
26
|
|
|
compress: { |
27
|
|
|
width: 1600, |
28
|
|
|
height: 1600, |
29
|
|
|
quality: 80 |
30
|
|
|
}, |
31
|
|
|
// handle response data,return image url |
32
|
|
|
uploadHandler(responseText){ |
33
|
|
|
//default accept json data like {ok:false,msg:"unexpected"} or {ok:true,data:"image url"} |
34
|
|
|
var json = JSON.parse(responseText) |
35
|
|
|
if (!json.ok) { |
36
|
|
|
alert(json.msg) |
|
|
|
|
37
|
|
|
} else { |
38
|
|
|
return json.data |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
}, |
42
|
|
|
//default en-us, en-us and zh-cn are built-in |
43
|
|
|
language: "en-us", |
44
|
|
|
// the modules you don't want |
45
|
|
|
hiddenModules: [ |
46
|
|
|
"full-screen", |
47
|
|
|
"info", |
48
|
|
|
"undo", |
49
|
|
|
], |
50
|
|
|
// keep only the modules you want and customize the order. |
51
|
|
|
// can be used with hiddenModules together |
52
|
|
|
visibleModules: [ |
53
|
|
|
"text", |
54
|
|
|
"color", |
55
|
|
|
"font", |
56
|
|
|
"align", |
57
|
|
|
"list", |
58
|
|
|
"link", |
59
|
|
|
"unlink", |
60
|
|
|
"tabulation", |
61
|
|
|
"image", |
62
|
|
|
"hr", |
63
|
|
|
"eraser", |
64
|
|
|
], |
65
|
|
|
// extended modules |
66
|
|
|
modules: { |
67
|
|
|
//omit,reference to source code of build-in modules |
68
|
|
|
} |
69
|
|
|
}); |
70
|
|
|
locale.use(lang); |
71
|
|
|
Vue.use(ElementUI); |
72
|
|
|
Vue.prototype.$http = axios.create(); |
73
|
|
|
|
74
|
|
|
new Vue({ |
|
|
|
|
75
|
|
|
el: '#root', |
76
|
|
|
data() { |
77
|
|
|
return { |
78
|
|
|
showModal: false |
79
|
|
|
} |
80
|
|
|
}, |
81
|
|
|
render: h => h(App), |
82
|
|
|
}); |